package com.pennywise.controller;

import com.pennywise.common.response.Result;
import com.pennywise.model.UserProfile;
import com.pennywise.service.UserProfileService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Tag(name = "用户配置管理")
@RestController
@RequestMapping("/api/profile")
@RequiredArgsConstructor
public class UserProfileController {
    
    private final UserProfileService userProfileService;
    
    @Operation(summary = "获取用户配置")
    @GetMapping
    public Result<UserProfile> getCurrentProfile() {
        return Result.success(userProfileService.getCurrentProfile());
    }
    
    @Operation(summary = "保存用户配置")
    @PostMapping
    public Result<Void> saveProfile(@RequestBody UserProfile profile) {
        userProfileService.saveProfile(profile);
        return Result.success(null);
    }
} 